﻿using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class WebMaster_Administrator_InNghiepVuDieuChinhTonKho_PrintNVDieuChinhTonKho : System.Web.UI.Page
{
    ClassExecute.ClassExecute dt;
    string str = BCDataCenter.Configuration.CurrentConnectionString;
    string error = "";
  
    protected void Page_Load(object sender, EventArgs e)
    {
        bindReport();
    }
    void bindReport()
    {
        try
        {
            if (Session["DocNo"] != null)
            {
                dt = new ClassExecute.ClassExecute();

                DataTable db = dt.Get_Data_DataTable(str, ref error, "ls_getAdjTrn4Print", CommandType.StoredProcedure,
                    new SqlParameter("@DocNo", Session["DocNo"].ToString()));
                if (db.Rows.Count > 0)
                {
                    gvListChiTietHoaDon.DataSource = db;
                    gvListChiTietHoaDon.DataBind();
                    LitNgay.Text = db.Rows[0]["docdate"].ToString();
                    LitKho.Text = db.Rows[0]["Kho"].ToString();
                    LitSO.Text = Session["DocNo"].ToString();
                    LitTongTien.Text = dt.GetDataDepend(str, "ls_getAdjTrnTotAmt", CommandType.StoredProcedure, ref error,
                        new SqlParameter("@DocNo", Session["DocNo"].ToString()));
                    PrintHelper.PrintWebControl(pnlPrintHoaDon);
                }
            }
            else
            {
                LitSO.Text = Session["DocNo"].ToString();
            }
           
        }
        catch 
        {
           
        }
    }
}